/**
 * Created by hongye.liu on 14-10-29.
 */
define(['jquery','underscore','backbone','global','./busLineResult','text!/android_asset/busAppWeb/module/busApp/busLine/busLine.html'],
    function($,_,Backbone,global,busLineResult,html){
        var busLineView = Backbone.View.extend({
            template: _.template(html),
            initialize:function(data){
                this.render();
                this.addListener();
            },
            render:function(){
                $('div#contentID').html(this.template);
                $('body').trigger("create");
            },
            addListener:function(){
                $(document).ready(function(){
                    $('#searchBusLineBtn').click(function(){
                        var linCondition = $('#lineCondition')[0].value;
                        if(global.city == '城市'){
                            alert('请先选择城市');
                        }else if(linCondition == null){
                            alert('搜索条件不能为空');
                        }else{
                            var busLineResultView = new busLineResult();
                            busLineResultView.searchBusLine(linCondition);
                        }
                    })
                })
            }
        });
        return busLineView;
    }
)